#pragma once
#include <map>
#include "SmartPtr.h"
#include "MAPIlib.h"



typedef struct tagKeyAuth
{
	CString strKey;
	CString	strCode;
	DWORD	dwCount;
	BOOL	bOpen;
} KEYAUTH;

typedef Smart_ptr::SmartPtr<KEYAUTH>	CKeyAuthPtr;
typedef std::map<CString, CKeyAuthPtr>	CKeyAuths;
typedef CKeyAuths::iterator				CKeyAuthIter;

class CRijndael;
class CTPAuthDlg;

class CTPAuthCenter
{
public:
	~CTPAuthCenter(void);

	static BOOL GetAuthorize(LPCTSTR lpstrTitle, LPCTSTR lpszCode);

private:
	CTPAuthCenter(void);
	static CTPAuthCenter* Instance();
	static void AdviseSinkCallback(IMsgStore *store, ULONG cNotif, LPNOTIFICATION lpNotifications);

	BOOL Save();
	BOOL Load();

	CKeyAuths			m_Authorizations;
	CRijndael*			m_pCrypt;
	CTPAuthDlg*			m_pAuthDlg;
};
